package com.aos.eap.adapter;


import com.aos.eap.R;
import com.aos.eap.bean.SearchThingBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


public class SearchThingListAdapter extends BaseQuickAdapter<SearchThingBean.MtmbodiesBean, BaseViewHolder> {


    public SearchThingListAdapter(@Nullable List<SearchThingBean.MtmbodiesBean> data) {
        super(R.layout.adapter_search_thing_list, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, final SearchThingBean.MtmbodiesBean item) {
        RecyclerView rvContentList = helper.getView(R.id.rvContentList);
        rvContentList.setLayoutManager(new LinearLayoutManager(mContext));
        rvContentList.setItemAnimator(new DefaultItemAnimator());
        rvContentList.addItemDecoration(new DividerItemDecoration(mContext, 1));
        SearchThingItemAdapter searchThingItemAdapter = new SearchThingItemAdapter(item.getMtmbodystructs());
        searchThingItemAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
        searchThingItemAdapter.isFirstOnly(true);
        rvContentList.setAdapter(searchThingItemAdapter);
    }
}
